<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/6
 * Time: 20:55
 */


require_once "../../php/config/database.php";
require_once "adminDb.php";
$AdminDb=new AdminDb();
$user=$_POST['user'];
$code=$_POST['emailCode'];
$email=$_POST['email'];
$data = $AdminDb->updateAdminEmail($user,$code,$email);
            try {
                $result = $data;
                if ($result) {
                    $dat = array(
                        'message' => "保存成功",

                    );
                    echo json_encode($dat);
                } else {
                    $dat = array(

                        'message' => "保存失败",

                    );
                    echo json_encode($dat);

                }
            }

            catch (Exception $e) {

                // 回滚事务
                // $pdo->rollback();
                echo $e->getMessage();
            }
